<template>
<div id="topo">
  <div class="viewBlock">
    <div id="topo-toolbar" class="toolBar clear">
      <!-- 工具栏 -->
      <toolbarComp ></toolbarComp>
      <topoToolbarComp></topoToolbarComp>
    </div>
  </div>
  <!-- 拓扑图  -->
  <topoGraphComp></topoGraphComp>
  <!-- 右键菜单 -->
  <topoContextMenuComp></topoContextMenuComp>

  <!-- 告警信息 -->
  <topoAlarmComp></topoAlarmComp>

</div>
</template>
<script>
import topoApi from 'api/topo'
import {TOPO_BTN_COMMON,TOPO_BTN_TOPO} from 'common/topo/toolbarBtn'

import toolbarComp from 'components/topo/toolbar.vue'
import topoToolbarComp from './topoToolbar.vue'
import topoContextMenuComp from './topoContextMenu.vue'
import topoGraphComp from './topoGraph.vue'
import topoAlarmComp from './topoAlarm.vue'
export default {
  data() {
    return {
      toolbarBtns: TOPO_BTN_COMMON.concat(TOPO_BTN_TOPO)
    }
  },
  components: {
    toolbarComp, topoToolbarComp, topoGraphComp, topoContextMenuComp, topoAlarmComp
  },
  mounted() {
    this.initSysIcons();
    this.initExchangerHostData();
    $('.container .main  .content-container').css({
      'overflow': 'hidden',
      'overflow-y': 'hidden'
    });
  },
  methods: {
    initSysIcons() {
      const self = this;

      this.$store.dispatch('getSysIcons').then((response) => {
      }).catch((err) =>{
        // self.$message({type: 'error', message: self.$t('get icons failed') + ', ' + err});
      });
    },
    initExchangerHostData() {
      const self = this;

      this.$store.dispatch('getExchangerInterfaceData').then((response) => {
      }).catch(err => {
        // self.$message({type: 'error', message: self.$t('get interface failed') + ', ' + err});
      });

      this.$store.dispatch('getExchangerHostData').then((response) => {
      }).catch(err => {
        // self.$message({type: 'error', message: self.$t('get interface failed') + ', ' + err});
      });

      this.$store.dispatch('getHostIdToIncomingAndOutgoingData').then((response) => {
      }).catch(err => {
        // self.$message({type: 'error', message: self.$t('get interface failed') + ', ' + err});
      });
    }
  }
}
</script>
